﻿<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="java.util.*" %>

<script language="javascript">
	var nullsearch = "搜索游戏,资讯,攻略";
	function doSearch()
	{
		var value = $("#searchtext").val();
		if (value=='' || value == nullsearch)
		{
			alert('请输入关键字');
			$("#searchtext").focus();
		}
		else if (value.length < 3)
		{
			alert('关键字太短，无法搜索');
			$("#searchtext").focus();
			$("#searchtext").select();
		}
		else
		{
			var uri = 'search.do?k='+ encodeURI(encodeURI(value));
			window.open(uri);
		}
	}
	$(document).ready(
		function()
		{
			$("#searchtext").keydown(
			function(e)
			{
				if(e.which==13) doSearch();
			}
			)
		}
	)
</script>
      
      
      <!-- 右侧栏 -->
      <div class="rightdiv">
        <!-- 搜索框 -->
		<ul class="searchborder">
			<li class="inlineli">
				<input id="searchtext" type="text" class="searchinput" value="搜索游戏,资讯,攻略" onfocus="if(this.value==nullsearch){this.value='';this.style.color='#000000';}" onblur="if(this.value==''){this.value=nullsearch;this.style.color='#888888';}" />
			</li>
			<li class="inlineli">
		        <a href="javascript:doSearch();" title="搜索" ></a>
			</li>
			<% java.util.Map count = (java.util.Map)request.getAttribute("count"); %>
			<span>共<%= count.get("games") %>个游戏，<%= count.get("articles") %>篇资讯文章</span>
		</ul>
		<!-- search -->
		
		<!-- 最热游戏TOP10 -->
		<div class="toplist rightbox_center">
			<h1 class="title">热门游戏</h1>
			<% List<java.util.Map> gameTop10 = (List<java.util.Map>)request.getAttribute("gameTop10"); %>
			<% for (int i=0;i<gameTop10.size();i++){ %>
				<a href="/gamedetail.do?id=<%= gameTop10.get(i).get("game_id") %>" title="<%=gameTop10.get(i).get("simplified_chinese_name")%>" target="_blank"><div class="toplist_icon" style="background-position:0px -<%= i*15 %>px;"></div><div class="toplist_text"><%= gameTop10.get(i).get("simplified_chinese_name") %></div></a>
			<% } %>
		</div>
		<div class="rightbox_bottom"></div>
		<!-- top -->
		
		<!-- 最近发售 -->
		<div class="toplist rightbox_center">
			<h1 class="title">最近发售</h1>
			<% List<java.util.Map> gameRecentTop10 = (List<java.util.Map>)request.getAttribute("gameRecentTop10"); %>
			<% for (int i=0;i<gameRecentTop10.size();i++){ %>
				<a href="/gamedetail.do?id=<%= gameRecentTop10.get(i).get("game_id") %>" title="<%=gameRecentTop10.get(i).get("simplified_chinese_name")%>" target="_blank"><div class="toplist_icon" style="background-position:0px -<%= i*15 %>px;"></div><div class="toplist_text"><%= gameRecentTop10.get(i).get("simplified_chinese_name") %></div></a>
			<% } %>
		</div>
		<div class="rightbox_bottom"></div>
		<!-- top -->
		
		<!-- 最热文章TOP10 -->
		<div class="toplist rightbox_center">
			<h1 class="title">电玩资讯</h1>
			<% List<java.util.Map> articleTop10 = (List<java.util.Map>)request.getAttribute("articleTop10"); %>
			<% for (int i=0;i<articleTop10.size();i++){ %>
				<a href="/articledetail.do?id=<%= articleTop10.get(i).get("article_id") %>" title="<%=articleTop10.get(i).get("article_name")%>" target="_blank"><div class="toplist_icon" style="background-position:0px -<%= i*15 %>px;"></div><div class="toplist_text"><%= articleTop10.get(i).get("article_name") %></div></a>
			<% } %>
		</div>
		<div class="rightbox_bottom"></div>
		<!-- top -->
      </div>
	  <!-- right -->

<script type="text/javascript">
	limitCharacterLength(".toplist>a div",24);
</script>